﻿using System;
using Microsoft.Reporting.WebForms;
using Pap.Web.Modules.Reports.ViewModel;
using Pap.Web.Utils;

namespace Pap.Web.Modules.Reports.Views
{
    /// <summary>
    /// 
    /// </summary>
    public partial class TestReports : BasePage<UsersTransactionsReportViewModel>
    {
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                FillddlCommittee();
                FillddlUsers();

                ReportDataSource datasource = new ReportDataSource("dsUsersTransactions",
                    ViewModel.GetUsersTransaction().Tables[0]);

                ReportViewer1.LocalReport.DataSources.Clear();
                ReportViewer1.LocalReport.DataSources.Add(datasource);
                ReportViewer1.LocalReport.Refresh();

            }

        }
        /// <summary>
        /// Fillddls the committee.
        /// </summary>
        private void FillddlCommittee()
        {
            ddlCommittee.DataSource = ViewModel.GetAllCommittees();
            ddlCommittee.DataBind();
        }
        /// <summary>
        /// Fillddls the users.
        /// </summary>
        private void FillddlUsers()
        {

        }
    }
}